package com.terrace.web.tagext.easyui;

import javax.servlet.jsp.JspException;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.terrace.web.tagext.easyui.model.GridColumn;
import com.terrace.web.tagext.easyui.support.DataGridTagSupport;
import com.terrace.web.tagext.easyui.support.GridColumnTagSupport;

/**
 * 表格列标签
 * 
 * @author jiangyg
 *
 */
public class DataGridColumnTag extends GridColumnTagSupport {

	private static final long serialVersionUID = -5812570300364664420L;

	/**
	 * 日志
	 */
	private static final Logger logger = LoggerFactory.getLogger(DataGridColumnTag.class);

	@Override
	public int doStartTag() throws JspException {
		return EVAL_PAGE;
	}

	@Override
	public int doEndTag() throws JspException {
		try {
			DataGridTagSupport dataGrid = (DataGridTagSupport) findAncestorWithClass(this, DataGridTagSupport.class);
			dataGrid.addGridColumn(new GridColumn(this));
		} catch (Exception e) {
			logger.error("生成表格列失败：", e);
		}
		return EVAL_PAGE;
	}

}
